﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace vuonthieunhi
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
                "Alias", // Route name
                "ho-tro/{alias}.html", // URL with parameters
                new { controller = "Home", action = "Articles", alias = UrlParameter.Optional } // Parameter defaults
            );
            routes.MapRoute(
               "Category", // Route name
               "danh-muc/{alias}.html", // URL with parameters
               new { controller = "Home", action = "Product", alias = UrlParameter.Optional } // Parameter defaults
           );
            routes.MapRoute(
               "ListView", // Route name
               "danh-sach/{alias}.html", // URL with parameters
               new { controller = "Home", action = "ProductView", alias = UrlParameter.Optional } // Parameter defaults
           );
            routes.MapRoute(
               "Detail", // Route name
               "san-pham/{alias}.html", // URL with parameters
               new { controller = "Home", action = "Detail", alias = UrlParameter.Optional } // Parameter defaults
           );
            routes.MapRoute(
               "AddCart", // Route name
               "them-gio-hang.html", // URL with parameters
               new { controller = "Home", action = "AddToCart"} // Parameter defaults
           );
            routes.MapRoute(
              "UpdateCart", // Route name
              "cap-nhat-gio-hang.html", // URL with parameters
              new { controller = "Home", action = "UpdateCart" } // Parameter defaults
          );
            routes.MapRoute(
               "payment", // Route name
               "gio-hang.html", // URL with parameters
               new { controller = "Home", action = "Payment" } // Parameter defaults
           );
            routes.MapRoute(
                "Captcha",
                "Mabaove",
                new { controller = "Home", action = "SetCaptcha" }
            );
            routes.MapRoute(
               "DeleteCart", // Route name
               "xoa-gio-hang/{alias}.html", // URL with parameters
               new { controller = "Home", action = "Delete", alias = UrlParameter.Optional } // Parameter defaults
           );
            routes.MapRoute(
               "Order", // Route name
               "thanh-toan.html", // URL with parameters
               new { controller = "Home", action = "Order"} // Parameter defaults
           );
            routes.MapRoute(
               "Info", // Route name
               "thong-bao.html", // URL with parameters
               new { controller = "Home", action = "Info" } // Parameter defaults
           );
            routes.MapRoute(
               "ErrorOrder", // Route name
               "trang-loi.html", // URL with parameters
               new { controller = "Home", action = "ErrorOrder" } // Parameter defaults
           );
            routes.MapRoute(
               "AdvanceSearch", // Route name
               "tim-kiem-nang-cao.html", // URL with parameters
               new { controller = "Home", action = "AdvanceSearch" } // Parameter defaults
           );
            routes.MapRoute(
              "Search", // Route name
              "tim-kiem.html", // URL with parameters
              new { controller = "Home", action = "GlobalSearch" } // Parameter defaults
          );
            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{alias}", // URL with parameters
                new { controller = "Home", action = "Index", alias = UrlParameter.Optional } // Parameter defaults
            );

            

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}